﻿using DAL;
using Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ValuationDAL
{
    /// <summary>
    /// 字典表
    /// </summary>
    public class DictionaryDAL
    {

        #region 绑定下拉框

        /// <summary>
        /// 绑定下拉框
        /// </summary>
        /// <returns></returns>
        public List<SysDictionary> ListSel(int i)
        {
            List<dynamic> type1 = EnumHelperDic.EnumListDic<EnumSelectType>();
            for (int b = 0; b < type1.Count; b++)
            {
                if (type1[b].value == i)
                {
                    return DictionaryList(i);
                }

            }
            return null;

        }

        /// <summary>
        /// 根据返回的类型显示字典
        /// </summary>
        /// <param name="i"></param>
        /// <returns></returns>
        public List<SysDictionary> DictionaryList(int i)
        {
            string sql = "select * from SysDictionary where Dictionary_Type='" + i + "' ";
            return DBHelper.ExecuteObjects<SysDictionary>(sql);

        }
        #endregion
      
    }
}
